home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / tex / dvivga9.arc / GBLVARS.H < prev    next >
C/C++ Source or Header  |  1988-10-21  |  16KB  |  378 lines

  1. /* -*-C-*- gblvars.h */
  2. /*-->gblvars*/
  3. /**********************************************************************/
  4. /****************************** gblvars *******************************/
  5. /**********************************************************************/
  6.  
  7. /**********************************************************************/
  8. /*********************  General Global Variables  *********************/
  9. /**********************************************************************/
  10.  
  11. char curpath[MAXFNAME];            /* current file area */
  12. char curext[MAXFNAME];            /* current file extension */
  13. char curname[MAXFNAME];            /* current file name */
  14.  
  15. UNSIGN16 debug_code;            /* 0 for no debug output */
  16.  
  17. char dviname[MAXFNAME];            /* DVI filespec */
  18. char dvoname[MAXFNAME];            /* device output filespec */
  19.  
  20. char fontlist[MAXSTR];            /* FONTLIST environment string */
  21. char fontpath[MAXFNAME];        /* font directory path */
  22.  
  23. char helpcmd[MAXSTR];            /* where to look for help */
  24.  
  25. char message[MAXMSG];            /* for formatting error messages */
  26.  
  27. /***********************************************************************
  28. Magnification table for 144dpi, 200dpi, and 300dpi devices, computed
  29. to 20 figures and sorted by magnitude.
  30.  
  31.     Column 1         Column 2         Column 3
  32. 0.72*sqrt(1.2)**i  sqrt(1.2)**I  1.5*sqrt(1.2)**I    (I = -16,16)
  33.  
  34. ***********************************************************************/
  35.  
  36. /*  original full list
  37. static float mag_table[] =
  38.     {
  39.         0.16744898601451165028, 0.18343117374303022733, 0.20093878321741398034,
  40.         0.22011740849163627280, 0.23256803936137783874, 0.24112653986089677641,
  41.         0.25476552262595201888, 0.26414089018996352736, 0.27908164723365340649,
  42.         0.28935184783307613169, 0.30571862715114242265, 0.31696906822795623283,
  43.         0.33489797668038408779, 0.34722221739969135802, 0.34885205904206675812,
  44.         0.36686235258137090718, 0.38036288187354747940, 0.38214828393892802832,
  45.         0.40187757201646090535, 0.41666666087962962963, 0.41862247085048010974,
  46.         0.44023482309764508862, 0.45643545824825697527, 0.45857794072671363398,
  47.         0.48225308641975308642, 0.49999999305555555556, 0.50234696502057613169,
  48.         0.52828178771717410634, 0.54772254989790837033, 0.55029352887205636077,
  49.         0.57870370370370370370, 0.59999999166666666667, 0.60281635802469135802,
  50.         0.63393814526060892761, 0.65726705987749004440, 0.66035223464646763293,
  51.         0.69444444444444444444, 0.71999999000000000000, 0.72337962962962962963,
  52.         0.76072577431273071313, 0.78872047185298805327, 0.79242268157576115952,
  53.         0.83333333333333333333, 0.86399998800000000000, 0.86805555555555555556,
  54.         0.91287092917527685576, 0.94646456622358566393, 0.95090721789091339142,
  55.         1.00000000000000000000, 1.03679998560000000000, 1.04166666666666666670,
  56.         1.09544511501033222690, 1.13575747946830279670, 1.14108866146909606970,
  57.         1.20000000000000000000, 1.24415998272000000000, 1.25000000000000000000,
  58.         1.31453413801239867230, 1.36290897536196335610, 1.36930639376291528360,
  59.         1.44000000000000000000, 1.49299197926400000000, 1.50000000000000000000,
  60.     1.57744096561487840680, 1.63549077043435602730, 1.64316767251549834040,
  61.     1.72800000000000000000, 1.79159037511680000000, 1.80000000000000000000,
  62.     1.89292915873785408810, 1.96258892452122723270, 1.97180120701859800840,
  63.     2.07360000000000000000, 2.14990845014016000000, 2.16000000000000000000,
  64.     2.27151499048542490570, 2.35510670942547267930, 2.36616144842231761010,
  65.     2.48832000000000000000, 2.57989014016819200000, 2.59200000000000000000,
  66.     2.72581798858250988690, 2.82612805131056721510, 2.83939373810678113220,
  67.     2.98598400000000000000, 3.09586816820183040000, 3.11040000000000000000,
  68.     3.27098158629901186430, 3.40727248572813735860, 3.58318080000000000000,
  69.     3.73248000000000000000, 3.92517790355881423710, 4.08872698287376483030,
  70.     4.29981696000000000000, 4.47897600000000000000, 4.90647237944851779640,
  71.     5.37477120000000000000, 5.88776685533822135560, 6.44972544000000000000
  72.     };
  73.  
  74. */
  75.  
  76. static float mag_table[] =
  77.     {
  78.  0.27908164723365340649,
  79.  0.31696906822795623283,
  80.  0.34885205904206675812,
  81.  0.38214828393892802832,
  82.  0.41862247085048010974,
  83.  0.45857794072671363398,
  84.  0.50234696502057613169,
  85.  0.55029352887205636077,
  86.  0.60281635802469135802,
  87.  0.66035223464646763293,
  88.  0.72337962962962962963,
  89.  0.79242268157576115952,
  90.  0.83333333333333333333,
  91.  0.86805555555555555556,
  92.  0.91287092917527685576,
  93.  0.95090721789091339142,
  94.  1.00000000000000000000,
  95.  1.04166666666666666670,
  96.  1.09544511501033222690,
  97.  1.14108866146909606970,
  98.  1.20000000000000000000,
  99.  1.25000000000000000000,
  100.  1.31453413801239867230,
  101.  1.36930639376291528360,
  102.  1.44000000000000000000,
  103.  1.50000000000000000000,
  104.  1.57744096561487840680,
  105.  1.64316767251549834040,
  106.  1.72800000000000000000,
  107.  1.80000000000000000000,
  108.  2.07360000000000000000,
  109.  2.16000000000000000000,
  110.  2.48832000000000000000,
  111.  2.59200000000000000000,
  112.  2.98598400000000000000,
  113.  3.11040000000000000000,
  114.  3.73248000000000000000, 
  115.  4.47897600000000000000, 
  116.  5.37477120000000000000,
  117.  5.88776685533822135560    };
  118.  
  119.  
  120.  
  121. INT16 mag_index;        /* set by actfact */
  122.  
  123. #define MAGTABSIZE (sizeof(mag_table) / sizeof(float))
  124.  
  125. int g_errenc = 0;        /* has an error been encountered?      */
  126. char g_logname[MAXSTR];        /* name of log file, if created          */
  127. BOOLEAN g_dolog = TRUE;        /* allow log file creation          */
  128. FILE *g_logfp = (FILE*)NULL;    /* log file pointer (for errors)      */
  129. char g_progname[MAXSTR];    /* program name                  */
  130.  
  131. FILE *plotfp = (FILE*)NULL;    /* plot file pointer              */
  132.  
  133. struct char_entry
  134. {                /* character entry              */
  135.    COORDINATE wp, hp;        /* width and height in pixels          */
  136.    COORDINATE xoffp, yoffp;    /* x offset and y offset in pixels      */
  137.    long fontrp;            /* font file raster pointer          */
  138.    UNSIGN32 tfmw;        /* TFM width                  */
  139.    INT32 dx, dy;        /* character escapements          */
  140.    UNSIGN16 pxlw;        /* pixel width == round(TFM width in      */
  141.                 /* pixels for .PXL files, or          */
  142.                 /* float(char_dx)/65536.0 for .GF and .PK */
  143.                 /* files)                  */
  144.    INT16 refcount;        /* reference count for memory management  */
  145.    UNSIGN32 *rasters;        /* raster description (dynamically loaded) */
  146.  
  147. #if    (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
  148.    BOOLEAN isloaded;        /* is the character already downloaded?   */
  149. #endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
  150.  
  151. #if    HPJETPLUS
  152.    BOOLEAN istoobig;        /* Too big (or too odd) to be loaded */
  153. #endif
  154.  
  155. #if    CANON_A2
  156.    BOOLEAN isknown;        /* Character is known */
  157.    BOOLEAN istoobig;        /* Too big to be loaded */
  158. #endif
  159.  
  160. #if    BBNBITGRAPH
  161.    BOOLEAN istoobig;        /* is the character too big for BitGraph? */
  162.    BOOLEAN isloaded;        /* is the character loaded in the BitGraph?*/
  163.    INT16 bgfont, bgchar;    /* BitGraph font and character          */
  164. #endif /* BBNBITGRAPH */
  165.  
  166. };
  167.  
  168. struct font_entry
  169. {
  170.     struct font_entry *next;    /* pointer to next font entry           */
  171.     void (*charxx)();        /* pointer to chargf(), charpk(), charpxl()*/
  172.     FILE *font_file_id;        /* file identifier (NULL if none)       */
  173.     INT32 k;            /* font number                             */
  174.     UNSIGN32 c;            /* checksum                                */
  175.     UNSIGN32 d;            /* design size                             */
  176.     UNSIGN32 s;            /* scale factor                            */
  177.     INT32 font_space;        /* computed from FNT_DEF s parameter       */
  178.     UNSIGN32 font_mag;        /* computed from FNT_DEF s and d parameters*/
  179.     UNSIGN32 magnification;    /* magnification read from PXL file       */
  180.     UNSIGN32 designsize;    /* design size read from PXL file       */
  181.     UNSIGN32 hppp;        /* horizontal pixels/point * 2**16       */
  182.     UNSIGN32 vppp;        /* vertical pixels/point * 2**16       */
  183.     INT32 min_m;        /* GF bounding box values           */
  184.     INT32 max_m;
  185.     INT32 min_n;
  186.     INT32 max_n;
  187.  
  188. #if    (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
  189.     UNSIGN16 font_number;    /* font number (0..32767) */
  190. #endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
  191.  
  192. #if    CANON_A2
  193.     COORDINATE cell_w;
  194.     COORDINATE cell_h;
  195.     COORDINATE cell_d;
  196.     UNSIGN16 nloaded;
  197.     UNSIGN32 storage;
  198. #endif /* CANON_A2 */
  199.  
  200.     BYTE font_type;        /* GF, PK, or PXL font file           */
  201.     BYTE a;            /* length of font area in n[]              */
  202.     BYTE l;            /* length of font name in n[]              */
  203.     char n[MAXSTR];        /* font area and name                      */
  204.     char name[MAXSTR];        /* full name of PXL file           */
  205.     struct char_entry ch[NPXLCHARS];/* character information           */
  206. };
  207.  
  208. struct font_list
  209. {
  210.     FILE *font_id;        /* file identifier               */
  211.     INT16 use_count;        /* count of "opens"               */
  212. };
  213.  
  214. INT32 cache_size;        /* record of how much character raster        */
  215.                 /* is actually used                */
  216. float conv;            /* converts DVI units to pixels            */
  217. UNSIGN16 copies;        /* number of copies to print of each page   */
  218. INT16 cur_page_number;        /* sequential output page number in 1..N    */
  219. INT16 cur_index;        /* current index in page_ptr[]              */
  220.  
  221. COORDINATE xcp,ycp;        /* current position                */
  222. UNSIGN32 den;            /* denominator specified in preamble        */
  223. FILE *dvifp = (FILE*)NULL;    /* DVI file pointer                */
  224. struct font_entry *fontptr;    /* font_entry pointer                */
  225. struct font_entry *hfontptr = (struct font_entry *)NULL;
  226.                 /* head font_entry pointer            */
  227.  
  228. #if    (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
  229. UNSIGN16 font_count;        /* used to assign unique font numbers        */
  230. struct font_entry *font_table[MAXFONTS];
  231. #endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
  232.  
  233. #if    (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
  234. BOOLEAN font_switched;        /* current font has changed            */
  235. #endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
  236.  
  237. INT16 gf_index, pk_index, pxl_index;
  238.                 /* indexes into filelist[] in fontfile();   */
  239.                 /* they define the search order, and are    */
  240.                 /* in initglob().                */
  241. UNSIGN32 gpower[33];        /* gpower[k] = 2**k-1 (k = 0..32)        */
  242. INT32 h;            /* current horizontal position            */
  243. COORDINATE hh;            /* current horizontal position in pixels    */
  244.  
  245. #if    HPLASERJET
  246. INT16 hpres;            /* output resolution (75, 100, 150, 300 dpi) */
  247. #endif /* HPLASERJET */
  248.  
  249. UNSIGN32 img_mask[32];        /* initialized at run-time so that bit k    */
  250.                 /* (counting from high end) is one        */
  251. UNSIGN32 img_row[(MAX_M - MIN_M + 1 + 31) >> 5];
  252.                 /* current character image row of bits        */
  253. INT16 max_m, min_m, max_n, min_n;
  254.                 /* current character matrix extents        */
  255. UNSIGN16 img_words;        /* number of words in use in img_row[]        */
  256. float leftmargin;        /* left margin in inches            */
  257. COORDINATE lmargin;        /* left margin offset in pixels            */
  258. INT16 nopen;            /* number of open PXL files            */
  259. INT16 page_count;        /* number of entries in page_ptr[]        */
  260.  
  261. #if    HPJETPLUS
  262. INT16 page_fonts;        /* count of fonts used on current page      */
  263. #endif /* HPJETPLUS */
  264.  
  265. long page_ptr[MAXPAGE+1];    /* byte pointers to pages (reverse order)   */
  266.  
  267. #if    POSTSCRIPT
  268. long page_loc[MAXPAGE+1];    /* byte pointers to output pages        */
  269. INT32 page_tex[MAXPAGE+1];    /* TeX's \count0 page numbers            */
  270. #endif /* POSTSCRIPT */
  271.  
  272. INT16 page_begin[MAXREQUEST+1],
  273.     page_end[MAXREQUEST+1],
  274.     page_step[MAXREQUEST+1];    /* explicit page range requests            */
  275. INT16 npage;            /* number of explicit page range requests   */
  276. struct font_list font_files[MAXOPEN+1];
  277.                 /* list of open PXL file identifiers        */
  278.  
  279. UNSIGN32 power[32];        /* power[k] = 1 << k                */
  280.  
  281. #if    POSTSCRIPT
  282. BOOLEAN ps_vmbug;        /* reload fonts on each page when TRUE        */
  283. #endif /* POSTSCRIPT */
  284.  
  285. UNSIGN32 rightones[HOST_WORD_SIZE];/* bit masks */
  286.  
  287. #if    (APPLEIMAGEWRITER | EPSON | DECLA75 | DECLN03PLUS)
  288. BOOLEAN runlengthcode = FALSE;        /* this is runtime option '-r' */
  289. #endif /* (APPLEIMAGEWRITER | EPSON | DECLA75 | DECLN03PLUS) */
  290.  
  291. #if    (GOLDENDAWNGL100 | TOSHIBAP1351)
  292. BOOLEAN runlengthcode = FALSE;        /* this is runtime option '-r' */
  293. #endif /* (GOLDENDAWNGL100 | TOSHIBAP1351) */
  294.  
  295. UNSIGN32 runmag;        /* runtime magnification            */
  296. UNSIGN32 mag;            /* magnification specified in preamble        */
  297. UNSIGN32 num;            /* numerator specified in preamble        */
  298. struct font_entry *pfontptr = (struct font_entry *)NULL;
  299.                 /* previous font_entry pointer            */
  300. BOOLEAN preload = TRUE;        /* preload the font descriptions?        */
  301. FILE *fontfp = (FILE*)NULL;    /* font file pointer                */
  302.  
  303. #if VGASCREEN
  304. BOOLEAN quiet = TRUE;
  305. BOOLEAN reversevideo = FALSE;   /* print black on white is default          */
  306. #else
  307. BOOLEAN quiet = FALSE;        /* suppress status display when TRUE        */
  308. #endif
  309.  
  310. BOOLEAN backwards = FALSE;    /* print in backwards order            */
  311.  
  312. #if    (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
  313. COORDINATE rule_height;        /* parameters of last rule set */
  314. COORDINATE rule_width;
  315. COORDINATE str_ycp;        /* last string ycp value */
  316. UNSIGN16 size_limit;        /* character size limit in pixels -- larger */
  317.                 /* characters are downloaded each time they */
  318.                 /* are required to avoid PostScript ROM bugs */
  319. #endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
  320.  
  321. #if    (BSD42 | OS_TOPS20)
  322. BOOLEAN spool_output = FALSE;    /* offer to send output to spooler */
  323. #endif /* (BSD42 | OS_TOPS20) */
  324.  
  325. char subpath[MAXFNAME];        /* font substitution file path            */
  326. char subname[MAXFNAME];        /* font substitution file name field        */
  327. char subext[MAXFNAME];        /* font substitution file extension field   */
  328. char subfile[MAXFNAME];        /* font substitution filename            */
  329.  
  330. INT32 tex_counter[10];        /* TeX c0..c9 counters on current page      */
  331. float topmargin;        /* top margin in inches                */
  332. COORDINATE tmargin;        /* top margin offset in pixels            */
  333.  
  334. INT32 v;            /* current vertical position            */
  335.  
  336. #if    VIRTUAL_FONTS
  337. BOOLEAN virt_font;        /* virtual font cache flag                  */
  338. struct virt_data
  339.     {
  340.     int    cnt;
  341.     char    *ptr;
  342.     char    *base;
  343.     };
  344. struct virt_data virt_save[_NFILE];/* space for saving old FILE values      */
  345. #endif /* VIRTUAL_FONTS */
  346.  
  347. COORDINATE vv;            /* current vertical position in pixels        */
  348.  
  349. #if    BBNBITGRAPH
  350. struct char_entry *bgcp[NBGFONTS+(NBGFONTS+2)/3][NPXLCHARS];
  351.     /* Pointer to corresponding char_entry for this BitGraph font */
  352.     /* and character.  These are used to set the char_entry's */
  353.     /* status to "not loaded" when we have to reuse the BitGraph */
  354.     /* character.  The array is cleared initially in devinit(). */
  355.  
  356. INT16 fullfont = 0;        /* full font to load in BitGraph        */
  357. BOOLEAN g_interactive=TRUE;    /* is the program running interactively   */
  358.                 /* (i.e., standard output not redirected)? */
  359. INT16 partchar = FIRSTBGCHAR;    /* partial font character to load in BitGraph*/
  360. INT16 partfont = NBGFONTS;    /* partial font to load in BitGraph        */
  361. INT16 pbghpos;            /* previous BitGraph horizontal position    */
  362. INT16 pbgvpos;            /* previous BitGraph vertical position        */
  363. INT16 pbgf = -1;        /* previous BitGraph font            */
  364. COORDINATE xdiff;        /* x difference                    */
  365. COORDINATE xscreen;        /* x screen adjustment                */
  366. COORDINATE ydiff;        /* y difference                    */
  367. COORDINATE yscreen;        /* y screen adjustment                */
  368. long cpagep;            /* pointer to current page in DVI file        */
  369. long ppagep;            /* pointer to previous page in DVI file     */
  370.  
  371. #if    OS_TOPS20
  372. #define jfn_plotfp (jfnof(fileno(plotfp)))
  373.  
  374. int bg_length,bg_width,bg_1ccoc,bg_2ccoc,bg_modeword,bg_sysmsg;
  375. #endif /* OS_TOPS20 */
  376.  
  377. #endif /* BBNBITGRAPH */
  378.